package Controller;

import java.io.File;
import javax.swing.*;
import javax.swing.filechooser.*;


public class SaveImageFilter extends FileFilter {
    private String descr;
    private String ext;
    public SaveImageFilter(String description, String extension) {
        descr = description;
        ext = extension;
    }

    public boolean accept(File f) {
        if (f.isDirectory()) {
            return true;
        }

        String extension = Utils.getExtension(f);
        if (extension != null) {
            if (extension.equals(ext)) {
                return true;
            } else {
                return false;
            }
        }

        return true;
    }

    public String getExtension() {
        return ext;
    }

    public String getDescription() {
        return descr;
    }
}
